<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"	
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a4j="http://richfaces.org/a4j"	        
    xmlns:p="http://primefaces.org/ui"    
    xmlns:c="http://java.sun.com/jsp/jstl/core">

<h:head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></meta>
	<title>EMMY</title>
	<style type="text/css"/>	
	<script type="text/javascript" src="../javascript/script_fonk.js " />
	<link rel="stylesheet" type="text/css" href="../css/global.css" />
	<link rel="stylesheet" type="text/css" href="../css/sablondaki.css" />
	<link rel="stylesheet" type="text/css" href="../theme/stylesheet.css" />
	<f:metadata>
 		<f:event listener="#{KullaniciBean.verifyUser}" type="preRenderView"/>		
	</f:metadata>
	
</h:head>
<h:body>
		
		<c:choose>
             <c:when test="${sessionScope.currentKullanici != null}" >
                    <c:set var="userGroup" value="#{sessionScope.currentKullanici.grup}"/>
					<h:outputLabel value="${sessionScope.currentKullanici.kullaniciid}" />
             </c:when>
             <c:otherwise>
        			<c:set var="userGroup" value="null"/>
             </c:otherwise>
        </c:choose>
	
		<h:form styleClass="form" id="ustMenu">
			<div id="masthead">
			<h1>
				<i>EMMY's place</i>
			</h1>
			<div id="mastheadBox">
				
			</div>
		</div>

			<ul id="nav">
			<li><a href="index.jsf">Anasayfa</a></li>
			<li><a href="firmaDetay.faces">Üreticiler</a>
				<ul>
					<li><a href="firmaDetay.faces">Üretici firmalar</a></li>
				</ul>
			</li>
			<li><a href="urunAramaListeleme.faces">Ürünler</a>
				<ul>
					<li><a href="index.faces">Yeni Ürünler</a></li>
					
					<c:if test="${userGroup== 1 }">
						<!-- kullanıcı == musteri -->
						<li><a href="#">Ürünlerim</a></li>
						<li><a href="urunAramaListeleme.faces">Ürün ara</a></li>
						<li><a href="#">Kayıp/Çalıntı</a></li>
					</c:if>

					<c:if test="${userGroup == 2 }">	
						<!-- kullanıcı == uretici -->
						<li><a href="#?f=id">Ürünlerim</a></li>
						<li><a href="urunAramaListeleme.faces">&nbsp;&nbsp;--&nbsp;&nbsp;Ürün Arama</a></li>
						<li><a href="#">&nbsp;&nbsp;--&nbsp;&nbsp;Yeni Ürün Ekle</a></li>
						<li><a href="#?f=id">&nbsp;&nbsp;--&nbsp;&nbsp;Ürün Bilgileri Güncelle</a></li>
						<li><a href="urunBilgiKaldir?f=id">&nbsp;&nbsp;--&nbsp;&nbsp;Ürün
								Bilgileri Kaldır</a></li>
					</c:if>

					<li><a href="urunAramaListeleme.faces">Ürün ara</a></li>
				</ul>
			</li>
				 <c:if test="${userGroup == 2 }">
				<!-- kullanıcı == uretici -->
				<li><a href="hata-cozumAraListele.faces">Ürün Hataları</a>
					<ul>
						<li><a href="hata-cozumAraListele.faces">Hata-Çözüm
								Listele</a></li>
						<li><a href="hata-cozumEkle.faces">Hata-Çözüm Ekle</a></li>
						<li><a href="hata-cozumDuzenle.faces">Hata-Çözüm Güncelle</a></li>
						<li><a href="hata-cozumKaldir.faces">Hata-Çözüm Sil</a></li>
						<li><a href="hata-cozumAraListele.faces?oz=saptanan">Saptanan
								Hataları listele</a></li>
					</ul></li>
				</c:if>

			<li><a href="yazilimAramaListeleme.faces">Yazılımlar</a>
				<ul>
					<li><a href="yazilimAramaListeleme.faces?yazturu=yeni">YeniYazılımlar</a></li>
					<li><a href="yazilimAramaListeleme.faces">Ürün Yazılımları</a></li>
					<c:if test="${userGroup == 1 }">
						<!-- kullanıcı == musteri -->
						<li><a href="#">Ürünlerime ait yazılımlar</a></li>
					</c:if>

					<c:if test="${userGroup == 2 }">	
						<!-- kullanıcı == uretici -->
						<li><a href="urunYazilimListele.faces?f=id">Yazılımlarım</a></li>

						<li><a href="urunYazilimEkle.faces">&nbsp;&nbsp;-- &nbsp;&nbsp;Yeni Yazılım Ekle</a></li>
						<li><a href="urunYazilimGuncelle.faces">&nbsp;&nbsp;--&nbsp;&nbsp;Yazılım Güncelle</a></li>
						<li><a href="urunYazilimKaldir.faces">&nbsp;&nbsp;--&nbsp;&nbsp;Yazılım	Sil</a></li>
					</c:if>

				</ul></li>
			<li><a href="duyuruListele.faces">Duyurular</a>
				<ul>
					<li><a href="duyuruListele.faces?duy=1">Üretici Firma
							Duyuruları</a></li>

					<c:if test="${userGroup == '2' }">	
						<!-- kullanıcı == uretici -->
						<li><a href="duyuruListele.faces?fid=id">Duyurularım</a></li>
						<li><a href="duyuruEkle.faces">&nbsp;&nbsp;--&nbsp;&nbsp;Duyuru Ekle</a></li>
						<li><a href="duyuruDuzenle.faces">&nbsp;&nbsp;--&nbsp;&nbsp;Duyuru Güncelle</a></li>
						<li><a href="duyuruKaldir.faces">&nbsp;&nbsp;--&nbsp;&nbsp;Duyuru Sil</a></li>
					</c:if>
				</ul>
			</li>
			<li><a href="iletisim.faces">Servis Sağlayıcı</a></li>
			<li><a href="musteriProDetay.faces">Profilim</a>
				<ul>		
					<c:choose>
						<c:when test="${userGroup == '1' }">
							<!-- kullanıcı ==müşteri -->
							<li><a href="musteriProDetay.faces">Düzenle</a></li>
						</c:when>
						<c:when test="${userGroup == '2' }">
							<!-- kullanıcı == temsilci -->
							<li><a href="#">Düzenle</a></li>
						</c:when>
					</c:choose>
				</ul>
			</li>
		</ul>
		</h:form>
		<h:form id="ustbodyarea">
			<ul id="breadCrumbs">
				<!-- "ustbodyarea" -->
				<h:outputText value="Hoşgeldiniz" />			
			</ul>
		</h:form>
		
			<div id="mainContent">  <!-- "bodyarea" -->
															
					<rich:message />						
				<ui:insert name="body"/>			
			</div>
		
		<h:form id="rightSide">
			<!-- Begin Side Column -->
			<div id="secondaryContent" align="center">
				<div class="secondaryContentBox">
					<p:growl id="loginGrowl" showDetail="true" life="3000" />
					<c:choose>
						<c:when test="${userGroup==1}">
							<h:outputLabel value="Welcome" /><br></br>
							<h:outputLabel value="sn. #{sessionScope.currentKullanici.musteri.ad}
										#{sessionScope.currentKullanici.musteri.soyad}" />
							
							  
				    		      <p:commandButton id="logoutButton" value="Logout" update=":rightSide"   
                    					actionListener="#{KullaniciBean.logout}"   
                    					onclick="setTimeout('redirectPage();' , 3000);"/>  
            			
						</c:when>
						<c:when test="${userGroup==2}">
							<h:outputLabel value="Welcome" /><br></br>
							<h:outputLabel value="sn. #{sessionScope.currentKullanici.temsilci.ad}
										#{sessionScope.currentKullanici.temsilci.soyad}" />
							
							<p:commandButton id="logoutButton2" value="Logout" update=":rightSide"   
                    					actionListener="#{KullaniciBean.logout}"   
                    					onclick="setTimeout('redirectPage();' , 3000);"/>
						</c:when>
						<c:otherwise>
							<h:outputLink id="loginLink" value="javascript:void(0)" onclick="loginDlg.show()" title="login">     
    							<h2 align="center">Üye Girişi</h2>  
							</h:outputLink> 
						
							<p:dialog id="loginDialog" header="Login" widgetVar="loginDlg">  
					        	<h:panelGrid columns="2" cellpadding="5">  
        	    					<h:outputLabel for="username" value="Username:" />  
            						<p:inputText value="#{KullaniciBean.currentKullanici.kullaniciAdi}"   
	            	        			id="username" required="true" label="username"
	            	        			requiredMessage="İsim boş bırakılamaz" converterMessage="İsim sadece harfleren oluşur"
	            	        			 />  
              	
    	        					<h:outputLabel for="password" value="Password:" />  
        	    					<h:inputSecret value="#{KullaniciBean.currentKullanici.parola}"   
            	        			id="password" required="true" label="password" />  
              
						            <f:facet name="footer">  
				    		            <p:commandButton id="loginButton" value="Login" update=":rightSide"   
                    						actionListener="#{KullaniciBean.login}"   
                    						oncomplete="loginDlg.hide(); setTimeout('redirectPage();' , 3000);"/>  
            						</f:facet>  
        						</h:panelGrid>  
							</p:dialog>  
						
								<br></br>
							<h2 align="center"><a href="musteriKayit.faces">Kaydol</a></h2>
							
						</c:otherwise>
					</c:choose>
					<br></br><br></br>
					<h2 align="center">								
						<rich:calendar styleClass="inputMiniCalendar" 
							datePattern="dd/MM/yyyy" inputStyle="width: 100px" 
							popup="false" style="height: 150px; width: 140px" showWeeksBar="false" />				
					</h2>
				</div>
				<blockquote>
				<h2>Duyurular</h2>
							
				<br></br>
				</blockquote>
    			 	<p:dataList value="#{DuyurularBean.duyuruList}" var="duyuruRS"
        				rows="5" effectSpeed="fast" pageLinks="1" style="">  
		   
		   			    <p:column >  
		   			    	<p:commandButton id="selectButton" update=":rightSide:duyuruDetay"
		   			    		oncomplete="duyuruDialog.show()" icon="ui-icon-search" title="View">  
                     			<f:setPropertyActionListener value="#{duyuruRS}" target="#{DuyurularBean.selectedDuyuru}" />  
                 			</p:commandButton>           					          					
                    					
		  					&nbsp;&nbsp;
        				    <h:outputText value="#{duyuruRS.tarih}, #{duyuruRS.baslik}" style="width:100px;" />  
          
        				</p:column>  
    				</p:dataList>  
    				<br></br>
      				<a href="./duyuruList.jsf"> Hepsini Gör </a>
    				<p:dialog header="Duyuru Detail" widgetVar="duyuruDialog" modal="true" showEffect="fade" 
    					id="duyuruDlg">  
        	    		<p:outputPanel id="duyuruDetay" style="text-align:center;" layout="block" >  
          				  
			    	      <p:graphicImage value="/images/search.jpg"/>  
              
        				  <h:panelGrid  columns="2" cellpadding="5">  
		    	    	  		<h:outputLabel for="baslik" value="Baslik : " />  
        		          		<h:outputText id="baslik" value="#{DuyurularBean.selectedDuyuru.baslik}" />  
                  
		  		                <h:outputLabel for="aciklama" value="Aciklama: " />  
    			           		<h:outputText id="aciklama" value="#{DuyurularBean.selectedDuyuru.aciklama}" />  
                  
        	    		  		<h:outputLabel for="tarih" value="Tarih: " />  
            	    	  		<h:outputText id="tarih" value="#{DuyurularBean.selectedDuyuru.tarih}" style="color:red"/>  
            			 </h:panelGrid>  
        				</p:outputPanel>  
    				</p:dialog>  
    			
				<br></br>
				<br></br>
				 <br></br>
				
			</div>
		</h:form>
			<!-- Begin Footer -->
		<h:form>
			<ul id="footer">
				<li>&copy; KEYSAN</li>
				<li><a href="http://www.comu.edu.tr">ÇOMÜ</a></li>
				<li><a href="http://yazilimakademisi.org/">IBM Yazılım
				Akademisi</a></li>
				<li><a href="iletisim.faces">İletişim</a></li>
			</ul>
		</h:form>
</h:body>
</html>